# model

# this class serves as an information page for the raid-5. it describes some basic features and link to a article (wikipedia)

from google.appengine.ext import webapp
from Utilities import *
from controller.BuildRaidInfoPage import *

class RaidFiveInfo(webapp.RequestHandler):
    def get(self):
        raidLevel = 'raidfiveinfo'
        infoUrl = 'http://de.wikipedia.org/wiki/RAID#RAID_5:_Leistung_.2B_Parit.C3.A4t.2C_Block-Level_Striping_mit_verteilter_Parit.C3.A4tsinformation'
        
        utilities = Utilities()
        
        # get some basic data
        username = utilities.getUsername()
        userText = utilities.getUserText()
        
        # routine if user is logged-in or not
        if username:
            urlText = utilities.getUrlTextLogout()
            url = utilities.getLogout(self)
            hintText = ''
            hintColor = ''

            headline = self.getHeadline()
            infoText = self.getInfoText()
            
            templateValues = {
                               'userText': userText,
                               'user': username,
                               'url': url,
                               'urlText': urlText,
                               'hintText': hintText,
                               'hintColor': hintColor,
                               'headline': headline,
                               'infoText': infoText
                              }
            self.callBuilder(self, templateValues, raidLevel, infoUrl)
        else:
            self.redirect('/')
            
    # contains the headline of the page
    def getHeadline(self):
#        headline = _('RAID-5 brief-information')
        headline = 'RAID-5 brief-information'
        return headline
            
    # contains the information text about raid-1
    def getInfoText(self):
#        infoText = _("")
        infoText = '<p>RAID-5 is a cluster of minimum three storage-devices (e.g. hard-disks or in this case cloud-based storage-services).</p>'
        infoText = infoText + '<p>In this cluster the data is split. Than a parity, of the pieces, is computed. With this parity the system can re-construct the data, if one piece is lost.</p>'
        infoText = infoText + '<p>With RAID-5 you have a better performance than with RAID-1. A great benefit is, that the data is split to all storage-services, so that no provider has the whole information.</p>'
        infoText = infoText + '<p>This fact increase the security aspect. Choose these RAID-level, if you need a better performance.</p>'
        infoText = infoText + '<p>Click more, to get detailed information.</p>'
        
        return infoText
    
    # call the responsible builder-class        
    def callBuilder(self, pSelf, templateValues, raidLevel, infoUrl):
        builder = BuildRaidInfoPage()
        builder.get(pSelf, templateValues, raidLevel, infoUrl)


